// @(#)inifile.hh
// Time-stamp: <2009-01-13 17:30:57 lancer>
// Copyright 2008 Julian Qian
// Author: root@localhost.localdomain
// Version: $Id: inifile.hh,v 0.0 2008/11/11 03:51:16 root Exp $
// Keywords:

#ifndef _INIFILE_H__
#define _INIFILE_H__

#include <map>
#include <string>
#include <algorithm>
#include <vector>
#include <fstream>
#include <functional>

typedef std::map<std::string, std::string, std::less<std::string> > strMap;
typedef strMap::iterator strMapIt;


class IniFile{
public:
    IniFile(){};
    virtual ~IniFile(){};
    bool open(const char* pinipath){
        return do_open(pinipath);
    }
    std::string read(const char*psect, const char*pkey);
protected:
    bool do_open(const char* pinipath);
    strMap c_inimap;
};

class Config: public IniFile {
public:
    static Config* theConfig(const char* conf);
    static void endConfig();
private:
    Config(const char* conf);
    virtual ~Config();
    
    static Config* _theConfig;
};

#endif
